package com.leetcode.p200;

import com.bean.ListNode;
import com.utils.DataUtils;

public class Test206 {

    public ListNode reverseList(ListNode head) {

        ListNode pre = null;
        ListNode cur = head;
        while (cur != null) {
            ListNode next = cur.next;
            cur.next = pre;
            pre = cur;
            cur = next;
        }
        return pre;
    }


    public static void main(String[] args) {
        Test206 test = new Test206();
        ListNode head = DataUtils.getOneToNumberListNode(10);
        DataUtils.printListNode(test.reverseList(head));
    }
}
